#ifndef _DS_LINK_LIST_H
#define _DS_LINK_LIST_H

#include "../ds_types.h"
#include <stdlib.h>

extern Status linklist_init(link_list *ll);

extern Status linklist_destroy(link_list *ll);

extern Status linklist_clear(link_list ll);

static inline Bool linklist_empty(link_list ll)
{
	return !(ll->next);
}

extern size_t linklist_length(link_list ll);

extern void *linklist_getelem(link_list ll, size_t i);

extern size_t linklist_locateelem(link_list ll, const void *e, 
		int cmp(const void *e1, const void *e2), 
		size_t struct_size);

extern Status linklist_insert(link_list ll, size_t i, const void *e,
		size_t struct_size);

extern Status linklist_delete(link_list ll, size_t i, void *e, 
		size_t struct_size);
extern void linklist_traverse(link_list ll, Bool visit(const void *));
extern void linklist_merge(link_list *la, link_list *lb, link_list *lc, 
			int compare(const void *, const void*));

#endif
